package com.baiytfp.hf.HFDataExchange.action.dao;

import com.baiytfp.hf.HFDataExchange.common.model.base.TableName;
import com.baiytfp.hf.HFDataExchange.common.model.table.CallLog;
import com.baiytfp.hf.baiytfp.common.db.HFPager;
import com.baiytfp.hf.baiytfp.hfutils.HFDBHelper;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Description: 调用日志CallLogDAOImpl.java
 * @author Host
 * @Date  2018/12/5 16:15
 * @Copyright (C)2018/12/5 , linksoft 
 *
 */
@Repository
public class CallLogDAOImpl  {

    /**
     * 查询列表信息（分页）
     * @param hfPager
     * @return
     * @throws Exception
     */
    public List<Map> query(HFPager hfPager) throws Exception{
        String sql=" select * from "+ TableName.CALL_LOG;
        List<Map> result = HFDBHelper.list_split(sql, Map.class, hfPager);
        return result;
    }

    /**
     * 通过id获取调用日志信息
     * @param id
     * @return
     * @throws Exception
     */
    public CallLog getById(String id)throws Exception{
        return HFDBHelper.read(TableName.CALL_LOG, " where cl_id = ? ", CallLog.class,new Object[]{id});
    }

    /**
     * 添加
     * @return
     */
    public long add(CallLog callLog)throws Exception{
        return HFDBHelper.add(TableName.CALL_LOG, callLog);
    }



}
